﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;
using System.Data;
using System.Text.RegularExpressions;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace BoletoElectronicoDesktop
{


    public static class PagoDAO
    {
        static public  DataTable ObtenerFacturasAPagar(string idBeneficiario, string fechaInicio, string fechaFin)
        {

            SqlConnection connection = new SqlConnection(Funciones.connectionString);
            SqlCommand command = new SqlCommand();
            connection.Open();
            command.Connection = connection;
            command.CommandType = System.Data.CommandType.StoredProcedure;
            command.CommandText = "[SELECTASTERISCO].Facturas_APagar";
            command.Parameters.AddWithValue("@idBeneficiario", idBeneficiario);
            command.Parameters.AddWithValue("@fechaInicial", fechaInicio);
            command.Parameters.AddWithValue("@fechaFinal", fechaFin);
            command.CommandTimeout = 10;
            SqlDataReader reader = command.ExecuteReader();
            DataTable dataTable = new DataTable();
            dataTable.Locale = System.Globalization.CultureInfo.InvariantCulture;
            dataTable.Load(reader);
            connection.Close();
            return dataTable;
            
        }//fin obtener facturas a pagar
        public static void PagarFactura(string idCompra, string monto, string idBeneficiario)
        {
            SqlConnection connection = new SqlConnection(Funciones.connectionString);
            SqlCommand command = new SqlCommand();
            connection.Open();
            command.Connection = connection;
            command.CommandType = System.Data.CommandType.StoredProcedure;
            command.CommandText = "[SELECTASTERISCO].[Compra_Pago]";
            command.Parameters.AddWithValue("@id", idCompra);
            
            SqlDataReader reader = command.ExecuteReader();
            DataTable dataTable = new DataTable();
            dataTable.Locale = System.Globalization.CultureInfo.InvariantCulture;
            dataTable.Load(reader);
            connection.Close();
        }
        





    }//fin de la clase
}//fin namespace